-
Notifications
You must be signed in to change notification settings - Fork 549
(compat) Added supported features and generation across Loader / Driver boundary - Part 2 #24855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(compat) Added supported features and generation across Loader / Driver boundary - Part 2 #24855
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends loader/driver compatibility checking to all drivers by propagating supportedFeatures
and generation
across the Loader/Driver boundary, and updates end-to-end tests accordingly.
- Tests: removed the local-only skip so compatibility tests run against every driver.
- Driver layers: added
ILayerCompatDetails
exports and getters in DocumentService implementations. - Shared utilities: updated
documentServiceProxy.ts
to expose underlying driver compatibility details.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/test/test-end-to-end-tests/src/test/layerCompat.spec.ts | Removed skip for non-local drivers in compatibility tests |
packages/loader/driver-utils/src/documentServiceProxy.ts | Imported and exposed ILayerCompatDetails from the underlying service |
packages/drivers/routerlicious-driver/src/runtimeLayerCompatState.ts | Added Routerlicious driver compat state export |
packages/drivers/routerlicious-driver/src/documentService.ts | Implemented ILayerCompatDetails getter in Routerlicious service |
packages/drivers/replay-driver/src/replayDocumentService.ts | Updated create and constructor to accept layer compat details |
packages/drivers/odsp-driver/src/odspRuntimeLayerCompatState.ts | Added ODSP driver compat state export |
packages/drivers/odsp-driver/src/odspDocumentService.ts | Implemented ILayerCompatDetails getter in ODSP service |
packages/drivers/odsp-driver/src/localOdspDriver/localOdspRuntimeLayerCompatState.ts | Added Local ODSP driver compat state export |
packages/drivers/odsp-driver/src/localOdspDriver/localOdspDocumentService.ts | Implemented ILayerCompatDetails getter in Local ODSP service |
Comments suppressed due to low confidence (4)
packages/test/test-end-to-end-tests/src/test/layerCompat.spec.ts:100
- After removing the local-only skip, tests will now run against drivers that lack
ILayerCompatDetails
and may fail. Add logic to skip providers without compatibility support (e.g., FileDocumentService, StaticStorageDocumentService).
provider = getTestObjectProvider();
packages/loader/driver-utils/src/documentServiceProxy.ts:31
- [nitpick] Using the interface name
ILayerCompatDetails
as a property name can cause confusion. Consider renaming the property tolayerCompatDetails
orcompatDetails
.
public readonly ILayerCompatDetails: ILayerCompatDetails | undefined;
packages/drivers/routerlicious-driver/src/runtimeLayerCompatState.ts:14
- [nitpick] The constant name
r11sDriverCompatDetailsForLoader
is an abbreviation (r11s
) while other drivers use full names (e.g.,odspDriverCompatDetailsForLoader
). For consistency, consider renaming torouterliciousDriverCompatDetailsForLoader
.
export const r11sDriverCompatDetailsForLoader: ILayerCompatDetails = {
packages/drivers/routerlicious-driver/src/documentService.ts:101
- The comment refers to the 'ODSP Driver layer' in the Routerlicious driver implementation. Update this to 'Routerlicious Driver layer' to avoid confusion.
* The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
f716415
to
6b9c1e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks for doing this Navin!
Reviewer Guidance
Follow up to #24462 which added the logic to local driver and the validation login in the Loader layer. This PR extends the same logic to other drivers as well.
Also, note that there are a couple of test-only document service implementations to which this logic is not added -
FileDocumentService
andStaticStorageDocumentService
. These drivers should not care about layer compatibility for now. If they do need this, it can be added later on a case-by-case basic. Keeping the logic on a need basis to keep things simple.Description
Added logic to support layer compatibility validation at the Loader / Driver layer boundary. Note that the validation only happens in the Loader layer and not in the Driver layer. This is because Driver layer doesn't call into any objects in the Loader layer. So, it doesn't need to support compat in that direction.
For context, please look at #22877 which added the same support to the Runtime / Loader boundary. This logic added by this PR is the same as in #22877.
Supported features
Driver
layer adds asupportedFeatures
property to thedocument service
that includes a set of features it supports. This is advertised to the Loader layer at the layer boundary.Loader
layer has arequiredFeatures
array that includes a set of features that it requires the driver layer to support in order to be compatible. Note that this is internal and is not advertised.Loader
layer validates that all the entries inrequiredFeatures
is present in thesupportedFeatures
of theDriver
. If not, it throws a usage error that says layers are not compatible.Driver
. For example, changes such as "does the driver support this new summary format foo" should add an entry to the supported features set of the driver.Generation
supported features
, ageneration
is also added to theDriver
layer. This is advertised to theLoader
layer at the layer boundary.Generation
is an integer which will be incremented every month. It can be used to validate compatibility more strictly (time-based) thansupported features
where layers are incompatible only if there are unsupported features.Note: The logic to update the generation will be added in a later PR. See AB#27054 for a proposed solution.
Loader
layer has aminSupportedGeneration
that it needs theDriver
layer to be at. Note that this is internal and is not advertised.Loader
layer validates that thegeneration
of theDriver
layer is>= minSupportedGeneration
.Loader
is at generation 20 and has aminSupportedGeneration
of 8 for theDriver
layer (12 month support window). If it sees thatDriver
's generation is lower than 8, the layers are incompatible.Backwards compatibility
To support older layers before layer compat enforcement is introduced, the
minSupportedGeneration
is set to 0 whereasgeneration
starts at 1. For older layers that did not implementILayerCompatDetails
, their generation is set to 0 andsupported features
is set to an empty set. So, theirgeneration
is compatible until we update theminSupportedGeneration
.AB#20807